// 获取元素
let info = document.querySelector('.info')
let productid = getQueryString('productid')
let submit = document.querySelector('.submit')

fetch(`http://chst.vip:1234/api/getmoneyctrlproduct?productid=${productid}`)
    .then(body => body.json())
    .then(res => {
        console.log(res)
        let el = ''
        let str = ''
        res.result.forEach(item => {
            // console.log(item)
            let regExp = /(?<=imgurl=)[^'"]*/
            let result = item.productImg2.match(regExp)

            el += `<h4>${item.productName}</h4>
            <div>
                <span>${item.productFrom}|${item.productTime}</span>
                <i>${item.productTips}</i>
            </div>
            <div class="content">
                <p>
                    <img src=${result} alt="">
                    ${item.productInfo2}
                </p>
            </div>
            <div>
                <img src="${result}" alt="">
            </div>
            <div class="city">
                ${item.productCity}
            </div>`

            str += `${item.productComment}`
        })
        info.innerHTML = el
        submit.innerHTML = str
    })

// 返回顶部
let toTop = $('.gotop').get(0)
// console.log(toTop)

toTop.onclick = function (e) {
    console.log(123)
    document.documentElement.scrollTop = 0;
}